<template>
	<view>
		<carHeader :title="'商户资料'"></carHeader>
		<view class="only">
			<view class="one">
				<p>
					<span>负责人：</span>
					<span>{{name}}</span>
				</p>
				<p>
					<span>身份证号码：</span>
					<span>{{idNum}}</span>
				</p>
				<p>
					<span>手机号：</span>
					<span>{{phone}}</span>
				</p>
				<p>
					<span>店名：</span>
					<span>{{shopName}}</span>
				</p>
				<p>
					<span>工商营业执照号码：</span>
					<span>{{shopId}}</span>
				</p>
				<p>
					<span>经营区域：</span>
					<span>{{shopAdress}}</span>
				</p>
				<p>
					<span>经营地址：</span>
					<span>{{shopHome}}</span>
				</p>
			</view>
			<view class="two">
				<view class="shop1">
					商家简介
				</view>
				<view class="shop2">
					{{message}}
				</view>
			</view>
			<view class="three">
				<view class="three1">
					身份证正反照片
				</view>
				<view class="three2">
					<image :src="idZheng" mode="aspectFit"></image>
					<image :src="idFan" mode="aspectFit"></image>
				</view>
			</view>
			<view class="four">
				<view class="four1">
					营业执照
				</view>
				<view class="four2">
					<image :src="businessImg" mode="aspectFit"></image>
				</view>
			</view>
			<view class="four">
				<view class="four1">
					门店照片
				</view>
				<view class="four2">
					<image :src="faceImg" mode="aspectFit"></image>
				</view>
			</view>
		
			<view class="button">
				<button type="primary" @click="toUpdate">修改</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name:"",
				idNum:null,
				phone:"",
				shopName:"",
				shopId:"",
				shopAdress:"",
				shopHome:"",
				message:"",
				idZheng:"",
				idFan:"",
				businessImg:"",
				faceImg:""
			};
		},
		created(){
			this.shopInfo();
		},
		onShow() {
			this.shopInfo();
		},
		methods: {
			shopInfo(){
				
				uni.request({
						url: 'http://localhost:8080/shop/' + this.$global.shopId, // 你的接口地址  
						method: 'GET', // 或者 'POST'  
						// 如果是POST请求，data字段用来发送请求参数  
						// data: {  
						//   key: 'value'  
						// },  
						// 设置请求的 header  
						header: {  
						  'content-type': 'application/json' // 根据需要设置  
						  // 'Authorization': 'Bearer ' + token // 示例：添加token到header中  
						},  
						success: (res) => {  
						  // 请求成功的回调  
						  console.log('请求成功：', res.data.data);
						  this.name = res.data.data.user.uName;
						  this.idNum = res.data.data.user.idNumber;
						  this.phone = res.data.data.user.pNumber;
						  this.shopName = res.data.data.shopName;
						  this.shopId = res.data.data.businessNumber;
						  this.shopAdress = res.data.data.area;
						  this.shopHome = res.data.data.address; 
						  this.message = res.data.data.shopJieshao; 
						  this.idZheng = res.data.data.idZheng; 
						  this.idFan = res.data.data.idFan; 
						  this.businessImg = res.data.data.businessImg; 
						  this.faceImg = res.data.data.faceImg; 
			            
						  // 假设后端返回的数据可以直接赋值给data  
						},  
						fail: (err) => {  
						  // 请求失败的回调  
						  console.error('请求失败：', err);  
						}  
					  });  
			},
			toUpdate(){
				uni.navigateTo({
					url:"/pages/register/register?shopId=" +  this.$global.shopId,
					
				})
			}
		}
	}
</script>

<style lang="scss">
.only{
	margin: 0 20rpx;
	position: relative;
	top: -240rpx;
	.one{
		font-weight: 550;
		font-size: 30rpx;
		background-color: #fff;
		border-radius: 50rpx;
		padding: 40rpx 30rpx;
		p {
			margin-top: 20rpx;
			display: flex;
			justify-content: space-between;
		}
	}
	.two {
		background-color: #fff;
		border-radius: 50rpx;
		padding: 40rpx 30rpx;
		margin-top: 20rpx;
		.shop1 {
			font-weight: 550;
			font-size: 30rpx;
		}
		.shop2 {
			margin-top: 20rpx;
			font-size: 24rpx;
			color: #b4b4b4;
		}
	}
	.three {
		background-color: #fff;
		border-radius: 50rpx;
		padding: 40rpx 30rpx;
		margin-top: 20rpx;
		.three1 {
			font-weight: 550;
			font-size: 30rpx;
		}
		.three2 {
			width: 500rpx;
			height: 160rpx;
			image {
				position: relative;
				top: -150rpx;
				width: 170rpx;
				margin-right: 40rpx;
			}
		}
	}
	.four {
		background-color: #fff;
		border-radius: 50rpx;
		padding: 40rpx 30rpx;
		margin-top: 20rpx;
		.four1 {
			font-weight: 550;
			font-size: 30rpx;
		}
		.four2 {
			width: 500rpx;
			height: 160rpx;
			image {
				position: relative;
				top: -150rpx;
				width: 170rpx;
				margin-right: 40rpx;
			}
		}
	
	}
	.button{
		margin: 50rpx 93.75rpx 0 93.75rpx;
		width: 75%;
	}
}
</style>
